package com.yunkeji.admin.controller.appuser;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.yunkeji.common.annotation.Log;
import com.yunkeji.common.core.controller.BaseController;
import com.yunkeji.common.core.domain.PageQuery;
import com.yunkeji.common.core.domain.R;
import com.yunkeji.common.core.page.TableDataInfo;
import com.yunkeji.common.enums.BusinessType;
import com.yunkeji.dao.domain.AppUserSpecial;
import com.yunkeji.dao.domain.InviteReward;
import com.yunkeji.dao.vo.AppUserSpecialVo;
import com.yunkeji.dao.vo.InviteRewardVo;
import com.yunkeji.system.domain.bo.AppUserSpecialBo;
import com.yunkeji.system.service.IAppUserSpecialService;
import com.yunkeji.system.service.IInviteRewardService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 特殊权限用户
 *
 * @author 雷擎宇
 * @date 2024-12-31
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/system/appUserSpecial")
public class AppUserSpecialController extends BaseController {

    private final IAppUserSpecialService specialService;

    /** 查询列表 */
    @SaCheckPermission("system:appUserSpecial:list")
    @GetMapping("/list")
    public TableDataInfo<AppUserSpecialVo> list(AppUserSpecialBo bo, PageQuery pageQuery) {
        return specialService.queryPageList(bo, pageQuery);
    }

    /** 新增 */
    @SaCheckPermission("system:appUserSpecial:add")
    @Log(title = "新增特殊权限用户", businessType = BusinessType.INSERT)
    @PostMapping()
    public R<Void> add(@RequestBody AppUserSpecialBo bo) {
        specialService.insertByBo(bo);
        return R.ok();
    }

    /** 删除 */
    @SaCheckPermission("system:appUserSpecial:delete")
    @Log(title = "删除特殊权限用户", businessType = BusinessType.DELETE)
    @DeleteMapping("/{id}")
    public R<Void> edit(@PathVariable Long id) {
        specialService.deleteWithValidByIds(id);
        return R.ok();
    }

}
